
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;

import net.lbjhs.game2d.KeyHandler;


public class GameWindow extends JFrame {
	TheWorld world = null;
	KeyHandler keys = new KeyHandler();
	ClientMessageSender cls;
	public GameWindow(ClientMessageSender cls) {
		setTitle("World of Chuahcraft");
		setSize(1024, 768);
		this.cls=cls;
		addComponents(getContentPane());
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
		setVisible(true);
	}

	public void addComponents(Container c) {
		c.setLayout(null);
		SynchQueue s = new SynchQueue();
		world = new TheWorld(s, cls);
		world.setBounds(0, 22, 1250, 1250);
		
		world.initialize();
		add(world);
		
		
		addKeyListener(keys);
		world.keys = this.keys;

	}

	

}